
<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Hệ thống quản lí thuốc online</title>
</head>
<body>
	<div id="wrapper">
		<%@ include file="../../layout/menubar.jsp"%>
		<%@ include file="../../layout/left-menu.jsp"%>
		<%@ include file="../../layout/header.jsp"%>
        <div id="page-wrapper">
        <div class="page-content">

                <!-- begin PAGE TITLE ROW -->
                <div class="row">
                    <div class="col-lg-12">
                        <div class="page-title">
                            <ol class="breadcrumb">
                                <li><i class="fa fa-dashboard"></i>  <a href="">Quản lí hóa đơn</a>
                                </li>
                            </ol>
                        </div>
                    </div>
                    <!-- /.col-lg-12 -->
                </div>
                <!-- /.row -->
                <!-- end PAGE TITLE ROW -->

                <!-- begin ADVANCED TABLES ROW -->
                <div class="row">

                    <div class="col-lg-12">

                        <div class="portlet portlet-default">
                            <div class="portlet-heading">
                                <div class="portlet-title">
                                    <h4>Danh sách</h4>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                            <input type="hidden" value="${roleCode}" id="roleCode"/>
                            <div class="portlet-body">
                                <div class="table-responsive">
                                	<div class="row form-group">                         		
										<div class="col-sm-6 col-xs-12">
												<label>Tên khách hàng: </label> <input type="text" style="width:200px; display: inline;"
													class="form-control" placeholder="Tên khách hàng" name="customerNameTxt" id="customerNameTxt" value="${customerName}">
										</div>
										<div class="col-sm-6 col-xs-12">
											<form action="list">
												<input type="hidden" value="listAllData" name="listAll" />
												<button type="submit"
													class="btn btn-default pull-right btn-square">
													<span class="glyphicon glyphicon-plus"></span>&nbsp;Hiển
													thị tất cả
												</button>
											</form>
										</div>
									</div>	
									<form action="searchByCustomerName" id = "searchByCustomerName">
										<input type="hidden" style="width:200px; display: inline;"
													class="form-control" placeholder="Tên khách hàng" name="customerName" id="customerName">									
										<div class="row form-group">
										
											<div class="col-sm-6 col-xs-12">
													<label>Từ ngày: </label>
													<input type="date" class="form-control" id="fromDate" name="fromDate"
														 value="" style="width:250px; display: inline; margin-left: 52px;">
											</div>
										</div>
										<div class="row form-group">
											<div class="col-sm-6 col-xs-12">
													<label>Đến ngày: </label>
													<input type="date" class="form-control" id="toDate" name="toDate"
														 value="" style="width:250px; display: inline; margin-left: 45px;">
													
											</div>
											<div class="col-sm-6 col-xs-12">
												<label style="float: right">Tổng giá trị: 
													<input type="text" class="form-control" readonly="readonly"
														 value="${totalValue} VND" style="width:175px; display: inline; margin-left: 5px;">
												</label>
											</div>
										</div>
										<div class="row form-group" id="creator">
											<div class="col-sm-6 col-xs-12">
												<label>Người tạo</label>
												<select value="" style="width:200px; display: inline; margin-left: 43px;"
													class="form-control" id="uId" name="uId">
													<c:forEach var="user" items="${users}">
														<option value="${user.getId()}">${user.getFullname()}</option>
													</c:forEach>
												</select>
											</div>
										</div>
										<div class="row form-group">
											<div></div>
											<button type="button" style="margin-left:133px;width: 200px;" onclick="searchDate()" class="btn btn-square btn-primary" style="width:100px; margin-left: 20px;">Tìm</button>
										</div>
									</form>
									
                                    <table id="example-table" class="table table-striped table-bordered table-hover table-green">
                                        <thead>
                                            <tr>
                                          		<th>STT</th>
                                          		<th>Mã hóa đơn</th>
                                            	<th>Ngày tạo hóa đơn</th>
                                            	<th>Tên khách hàng</th>      
                                                <th>Tổng giá trị bán hàng</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        		<%int i = 0; %>
                                        		<c:forEach var="bill" items="${bills}">
                                        		<%i++;%>
												<tr>
													<th><%=i %></th>
													<td>${bill.getBillNumber()}</td>
													<td>${bill.getBillDate()}</td>
													<td>${bill.getCustomerName()}</td>
													<td>${bill.getTotalValue()} VND</td>
												</tr>
												</c:forEach>
												
										</tbody>
										
                                    </table>
                                </div>
                                <!-- /.table-responsive -->
                            </div>
                            <!-- /.portlet-body -->
							<div class="portlet-footer">
								<div class="clearfix"></div>
							</div>
							<!-- /.portlet-footer -->
						</div>
                        <!-- /.portlet -->

                    </div>
                    <!-- /.col-lg-12 -->

                </div>
                <!-- /.row -->

            </div>
            <!-- /.page-content -->

        </div>
        <!-- /#page-wrapper -->
        <!-- end MAIN PAGE CONTENT -->
        </div>
	<!-- Modal add user -->
	<%@ include file="create.jsp"%>
	<%@ include file="detail.jsp"%>
</body>
<script type="text/javascript">
	var role = document.getElementById("roleCode").value;
	if(role !="ROLE_STORE_OWNER"){
		document.getElementById("creator").style.display = 'none';
	}
 	function editButtonTouched(id,fullname, name, password, email) {
 		debugger;
 	    document.getElementById("userIdeee").value = id;
 	    document.getElementById("updateFullname").value = fullname;
 	    document.getElementById("usernameeee").value = name;
 	    document.getElementById("inputPassword").value = password;
 	    document.getElementById("emaileee").value = email;
 	    document.getElementById("confirmPass").value = password;
 	    document.getElementById("deleteuser").value = id;
 	};
	
 	function deleteUser() {
 	    var id = document.getElementById("deleteuser").value;
 	    var html = "";
 	    $.ajax({
 	        cache: false,
 	        type: "GET",
 	        url: "delete",
 	        data: {
 	            "userId": id
 	        },
 	        success: function (data) {
 	            location.reload();
 	        },
 	        error: function (data) {
 	            alert("error");
 	        }
 	    });
 	};
 	function searchDate(){
 		var customerName = document.getElementById("customerNameTxt").value;
 		document.getElementById("customerName").value = customerName;
 		document.getElementById("searchByCustomerName").submit();
 	}
</script>

<!-- Mirrored from themes.startbootstrap.com/flex-admin-v1.2/blank.html by HTTrack Website Copier/3.x [XR&CO'2013], Wed, 19 Mar 2014 06:24:44 GMT -->
</html>
